<template>
	<view class="content">
		<web-view :src="link" v-if="link"></web-view>
	</view>
</template>

<script>
	import { getConfig } from '../../api';
	import { systemInfo } from '@/utils/mixin';
	
	export default {
		mixins: [systemInfo],
		data() {
			return {
				link: null
			}
		},
		onLoad({code}) {
			this.getSystemInfo();
			this.loadConfig();
		},
		methods: {
			async loadConfig() {
				const res = await getConfig(this.platform, this.version);
				this.data = res.data;
				this.$store.state.onlineAudit = this.data.online_audit;
				this.$store.state.kefu = this.data.kefu;
				// #ifdef MP-WEIXIN
				if (this.version.endsWith("002")) {
					this.link = this.$store.state.kefu.mp_weixin_002;
				} else {
					this.link = this.$store.state.kefu.mp_weixin_001;
				}
				// #endif
				// #ifdef MP-ALIPAY
				this.link = this.$store.state.kefu.mp_alipay_001;
				// #endif
				if (!this.link) {
					this.link = this.$store.state.kefu.h5;
				}
			}
		}
	}
</script>

<style>

</style>
